package leeon.bbsbrower.views;

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;

public class BrowerDialog extends Dialog { 
	
	private String url = null;
	
	/**
	 * Create the dialog
	 */
	public BrowerDialog(Shell parentShell, String url) {
		super(parentShell);
		this.url = url;
	}
	
	/**
	 * Create contents of the dialog
	 * @param parent
	 */
	protected Control createDialogArea(Composite parent) {
		Composite container = (Composite) super.createDialogArea(parent);
		container.setLayout(new FillLayout());
		Browser browser = new Browser(container, SWT.NONE);
		browser.setUrl(this.url);
		
		
		return container;
	}
	
	
    /**
     * 设定窗口的标题和图片
     */
    protected void configureShell(Shell shell) {
    	super.configureShell(shell);
    	shell.setText("浏览器浏览");
    }
	
		

	/**
	 * 去掉下面的button bar
	 */
	protected Control createButtonBar(Composite parent) {
		return null;
	}
	
	/**
	 * Return the initial size of the dialog
	 */
	protected Point getInitialSize() {
		return new Point(1024, 768);
	}

}
